package org.example.maven.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.maven.pojo.ProvenanceSource;

import java.util.List;

@Mapper
public interface provenanceSourceMapper {
    //添加来源信息
    @Insert("insert into provenance_source(collection_id ,acquisition_type,  acquisition_date, donor_name , source_detail ,certificate_no) values (#{collectionId},#{acquisitionType},#{acquisitionDate},#{donorName},#{sourceDetail},#{certificateNo})")
    void addProvenanceSource(ProvenanceSource provenanceSource);

    //一次插入多条来源信息
    void addProvenanceSourceList(List<ProvenanceSource>list);

    //根据id获取来源信息
    @Select("select id,acquisition_type,donor_name,source_detail,certificate_no from provenance_source where collection_id=#{collectionId}")
    ProvenanceSource getProvenanceSourceById(Integer collectionId);


}
